<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>文化旅游</title>
    <link rel="stylesheet" href="../../icon/iconfont.css">
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link rel="stylesheet" href="../../css/aui.css">
    <style>
        body {
        }

        header {
            padding: 1.6rem 0.8rem 0.5rem 0.8rem;
            position: fixed;
            top: 0;
            background-color: #fff;
            width: 100%
        }

        header span:nth-of-type(1) {
            font-size: 1rem
        }

        header span:nth-of-type(2) {
            font-size: 1rem
        }
        .imgBox{
          margin-bottom: 1rem
        }
        .banner{
          padding-top: 4rem;
        }
    </style>
</head>

<body>
    <!-- 头部 -->
    <header>
        <span class="iconfont icon-fanhui" onClick="api.closeWin()"></span>
        <span>更多活动</span>
    </header>
    <div class="banner" id="banner" style="padding-bottom:1rem">

    </div>
</body>
<script type="text/javascript" src="../../lib/zepto.js"></script>
<script type="text/javascript" src="../../lib/artTemplate/template.js"></script>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/dns.js"></script>
<script type="text/html" id="bannerList">
  {{each items as value index}}
    <h2 class="banner_title" style="font-size:0.8rem;margin-bottom:0.5rem;padding: 0 0.8rem;">{{value.title}}</h2>
    <div class="imgBox" style="width:100%;height:10rem" activeId="{{value.href_url}}">
      <img src="{{value.img_id.url}}" alt="" style="width:100%;height:100%">
    </div>
  {{/each}}
</script>
<script>
    apiready = function() {
        getbannerAll()
    }

    function getbannerAll() {
        $.ajax({
            type: "get",
            url: dns + "banner/read",
            success: function(res) {
                console.log(JSON.stringify(res));
                var html = template("bannerList",{'items':res.data});
                document.getElementById("banner").innerHTML = html;
                $(".imgBox").each(function () {
                  $(this).click(function () {
                    var activeId = $(this).attr("activeId");//自定义属性的值
                    var index = activeId.indexOf("=");//索引
                    var type = activeId.substr(0,index);//类型
                    var id = activeId.substr(index+1);//id
                    if(type=="news"){
                      localStorage.setItem("articleID",id);
                      api.openWin({
                          name: 'article',
                          url: './article.html',
                          allowEdit:true,
                          pageParam: {}, //页面代参数
                          rect: {
                              x: 0,
                              y: 0,
                              w: api.winWidth,
                              h: api.winHeight
                          }
                      });
                    };
                    if(type=="booking"){
                      localStorage.setItem("articleID",id);
                      // 跳转到其它页面暂停当前页面的视频
                      getvideo()
                      api.openWin({
                          name: 'frame1-details',
                          url: '../frame1/frame1_details.html',
                          allowEdit:true,
                          pageParam: {}, //页面代参数
                          rect: {
                              x: 0,
                              y: 0,
                              w: api.winWidth,
                              h: api.winHeight
                          }
                      });
                    };
                  })
                })
            }
        })
    }
</script>

</html>
